//Συνδεση του DeleteUser με τη βαση δεδομενων μεσω του javaconnect2
package DAO;

import Interfaces.IDeleteUser_Dao;
import Models.DeleteUser;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class DeleteUser_Dao implements IDeleteUser_Dao {


    public  DeleteUser deleteUser(String username, String pass) throws IllegalArgumentException {

        Connection conn = null;
        PreparedStatement pst = null;
        conn = javaconnect2.connectDB();
        String query = "DELETE  FROM user WHERE username=? and password=?";
        try {
            pst = conn.prepareStatement(query);
            pst.setString(1, username);
            pst.setString(2, pass);
            pst.execute();
            pst.close();
            conn.close();
        } catch (SQLException e) {
            throw new IllegalArgumentException("Error in Delete_Dao ");
        }
        return null;
    }
}
